package com.example.demojparestcrud.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;

import com.example.demojparestcrud.model.Tutorial;
import org.springframework.data.jpa.repository.Query;

public interface TutorialRepository extends JpaRepository<Tutorial, Long> {
	List<Tutorial> findByPublished(boolean published);
	List<Tutorial> findByTitleContaining(String title);

	@Query(value = "select * from tutorials where price=(select max(price) from tutorials)",
			nativeQuery = true)
	Tutorial getMax();
}
